import type { App } from 'vue'

interface Use {
  install: (app: App, ...options: Array<any>) => void
}

const pluginList = new Set()
export function UsePlugin<T extends Use>(app: App, plugin: T, ...options: Array<any>) {
  if (pluginList.has(plugin)) {
    console.error('组件已注册', plugin)
    return
  }
  app.use(plugin, options)
  pluginList.add(plugin)
}